﻿

namespace Mulala.Cavan.Presentation.Mvc.ViewModel
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
using Mulala.Cavan.Domain.MainBoundedContext.ConsignModule;
    using Mulala.Cavan.Presentation.Seedwork;

    public class ConsignBidderViewModelConverter
    {
        public static IList<IConsignBidderViewModel> Convert(IList<ConsignBidder> consignBidders)
        {
            IList<IConsignBidderViewModel> consignBidderViewModels = new List<IConsignBidderViewModel>();
            foreach (ConsignBidder cb in consignBidders)
            {
                IConsignBidderViewModel consignBidderViewModel = ModelFactory.CreateModel<IConsignBidderViewModel>();
                consignBidderViewModel.Item = cb;
                if (cb.ConsignBidderStatus == ConsignIdentifier.ConsignBidderStatus.IsAccepted)
                {
                    consignBidderViewModel.Status = "已接受";
                }
                else if (cb.ConsignBidderStatus == ConsignIdentifier.ConsignBidderStatus.IsCanceled)
                {
                    consignBidderViewModel.Status = "已取消";
                }
                else if (cb.ConsignBidderStatus == ConsignIdentifier.ConsignBidderStatus.IsNew)
                {
                    consignBidderViewModel.Status = "在竞标";
                }
                consignBidderViewModels.Add(consignBidderViewModel);
            }
            return consignBidderViewModels;
        }
    }
}
